function HandleSearchDateZone(gui, operator, now, options) {
  this._gui = gui;
  this._operator = operator;
  this._now = now;
  this._options = options;
  this._popupBox = new PopupBox();
  
  this._callbackFunc = (options && options.callbackFunc) ? options.callbackFunc : null;
  this._callbackFunc1 = (options && options.callbackFunc1) ? options.callbackFunc1 : null;
  this._search = (options && options.search) ? options.search : null;
  this._template = (options && options.template) ? options.template : '';
  this._dateZones = (options && options.dateZones) ? options.dateZones : '';
  
  if (!this._search) {
    this._search = { dateFrom: null,
                     dateTo: null
                   };
  }
  this._dateZone = { created: '',
                     to: ''
                   };
  this._createElements();
};

HandleSearchDateZone.prototype._createElements = function() {
  var _self = this;

  this._gui.dateCreated.value = (this._dateZone.created) ? SimpleDate.format(this._dateZone.created) : '';
  this._gui.dateCreated.onclick = function() { var context = this;
                                               _self._changeDate.call(_self, this, _self._dateZone.created, function(sd) { _self._dateZone.created = sd; context.focus(); }, false);
                                               return false;
                                             };
  this._gui.dateTo.value = (this._dateZone.to) ? SimpleDate.format(this._dateZone.to) : '';
  this._gui.dateTo.onclick = function() { var context = this;
                                          _self._changeDate.call(_self, this, _self._dateZone.to, function(sd) { _self._dateZone.to = sd; context.focus(); }, false);
                                          return false;
                                        };
  this._gui.create.onclick = function() { if (_self._dateZone.created &&_self._dateZone.to) {
                                            var date = DateZone.instance();
                                            date.start = _self._dateZone.created;
                                            date.end = _self._dateZone.to;
                                            date.page = _self._template;
                                            new RequestUtils()._write('datezone', [date], [], function() { _self._callbackFunc1.call(_self); }, DOMUtils.findPos(this));
                                          } else {
                                            window.alert('DATE NOT BE EMPTY');
                                          }
                                        };
  var table = document.createElement('table');
  table.style.width = '166px';
  table.cellPadding = 0;
  table.cellSpacing = 0;
  this._gui.result.appendChild(table);
  
  for (var i = 0, il = this._dateZones.length; i < il; i++) {
    var date = this._dateZones[i];
    tr = table.insertRow(-1);
    tr.className = (tr.rowIndex % 2 == 0) ? 'rowodd' : 'roweven';
    td = tr.insertCell(-1);
    td.style.width = '146px';
    td.style.height = '20px';
    td.style.textAlign = 'center';
    var a = document.createElement('a');
    a.href = '#';
    a._date = date;
    a.appendChild(document.createTextNode(SimpleDate.format(date.start) + ' - ' + SimpleDate.format(date.end)));
    a.onclick = function() { _self._search.dateFrom = this._date.start;
                             _self._search.dateTo = this._date.end;
                             _self._callbackFunc(_self._search);
                             return false;
                           };
    td.appendChild(a);
    td = tr.insertCell(-1);
    td.style.width = '20px';
    td.style.textAlign = 'center';
    var span = document.createElement('span');
    span.appendChild(document.createTextNode('(x)'));
    span.style.cursor = 'pointer';
    span._date = date;
    span.onclick = function() { new RequestUtils()._write('datezone', [], [this._date], function() { _self._callbackFunc1.call(_self); }, null);
                              };
    td.appendChild(span);
  }
};

HandleSearchDateZone.prototype._changeDate = function(label, currentDate, onChangeFunc, showTime) {
  var _self = this;
  this._wContainer = document.createElement('div');
  this._wContainer.style.left = DOMUtils.findPos(label)[0] + 'px';
  this._wContainer.style.top = DOMUtils.findPos(label)[1] + 'px';
  this._popupBox._open(this._wContainer, { pos: DOMUtils.findPos(label) });
  
  var ds = new DateSelect(currentDate, null, { container: this._wContainer, showTime: showTime });
  ds._selectFunc = function(sd) { _self._selectDate.call(_self, sd, label, onChangeFunc, showTime); };
};

HandleSearchDateZone.prototype._selectDate = function(sd, label, onChangeFunc, showTime) {
  
  onChangeFunc(sd);
  this._showDate(sd, label, showTime);
  this._popupBox._close();
};

HandleSearchDateZone.prototype._showDate = function(sd, label, showTime) {
  if (sd) { 
    label.value = SimpleDate.format(sd, showTime);
  } else {
    label.value = '';
  }
};